﻿CREATE FUNCTION [dbo].[fn_Tables] ()
RETURNS @Tables TABLE (TableName sysname)
AS
BEGIN
	INSERT INTO @Tables
	  (
	    Tablename
	  )
	SELECT TableName
	FROM   dbo.fn_TablesAll()
	WHERE  TableName NOT IN (SELECT TableName
	                         FROM   dbo.fn_TablesToIgnore())
	       AND TableName NOT LIKE 'aspnet_%'
	
	RETURN
END